﻿<Window x:Class="CommunitySettlers.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:this="clr-namespace:CommunitySettlers"
        Title="CommunitySettlers MILESTONE 1" Height="640" Width="800" PreviewKeyDown="Window_PreviewKeyDown" Initialized="Window_Initialized">
    <Grid>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="230"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <ContentControl Grid.Column="1" Name="PANEL_GameSurface"/>

            <Grid Grid.Column="0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="350"/>
                </Grid.RowDefinitions>
                
                <this:Wizard x:Name="WIZARD_MainWizard">
                    <TabItem Name="TAB_MainTabControl">
                        <TabControl>
                            <TabItem Header="Buildings">
                                <Grid>
                                    <Grid Grid.Row="0">
                                        <ItemsControl HorizontalAlignment="Stretch" Margin="0,35,0,0" Name="LIST_Buildable" VerticalAlignment="Stretch">
                                            <ItemsControl.ItemsPanel>
                                                <ItemsPanelTemplate>
                                                    <WrapPanel />
                                                </ItemsPanelTemplate>
                                            </ItemsControl.ItemsPanel>
                                            <ItemsControl.ItemTemplate>
                                                <DataTemplate>
                                                    <Border BorderBrush="Gray" Background="GhostWhite" BorderThickness="1" CornerRadius="4" Margin="5" Tag="{Binding}" Padding="5"
                                                        Cursor="Hand" MouseLeftButtonUp="Border_MouseLeftButtonUp">
                                                        <Image Margin="2" Width="70" Height="70" Source="{Binding Source}" ToolTip="{Binding Tooltip}" Stretch="Uniform"/>
                                                    </Border>
                                                </DataTemplate>
                                            </ItemsControl.ItemTemplate>
                                            <ItemsControl.Template>
                                                <ControlTemplate>
                                                    <ScrollViewer VerticalScrollBarVisibility="Visible" >
                                                        <ItemsPresenter />
                                                    </ScrollViewer>
                                                </ControlTemplate>
                                            </ItemsControl.Template>
                                        </ItemsControl>
                                    </Grid>
                                </Grid>
                            </TabItem>
                            <TabItem Header="tabItem1" Name="tabItem1">
                                <Grid>
                                    <Button Content="Dump" Height="23" HorizontalAlignment="Left" Margin="6,6,0,0" Name="BTN_Dump" VerticalAlignment="Top" Width="75" Click="BTN_Dump_Click" />
                                </Grid>
                            </TabItem>
                        </TabControl>
                    </TabItem>
                    <TabItem Name="TAB_WarehouseConfig">
                        <Grid>
                            <GroupBox Header="Warehouse Configuration:" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                <StackPanel Orientation="Vertical">
                                    <Label Content="You may select 8 items to be stored." Height="28" HorizontalAlignment="Left"  Name="label2" VerticalAlignment="Top" />
                                    
                                    <ItemsControl Margin="0,0,0,0" ItemsSource="{Binding Game.AllResources}" MinHeight="60">
                                        <ItemsControl.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <WrapPanel />
                                            </ItemsPanelTemplate>
                                        </ItemsControl.ItemsPanel>
                                        <ItemsControl.ItemTemplate>
                                            <DataTemplate>
                                                <Button Height="30" HorizontalAlignment="Left" Margin="6,4,0,0" VerticalAlignment="Top" Width="30" Tag="{Binding}" Click="BTN_WarehouseAdd_Click">
                                                    <Image Source="{Binding Converter={StaticResource ResourceThumbnailConverter}}" Stretch="Uniform"/>
                                                </Button>
                                            </DataTemplate>
                                        </ItemsControl.ItemTemplate>
                                    </ItemsControl>
                                    
                                    <Grid Height="70">
                                        <Image Source="/Icons/Warehouse.png" HorizontalAlignment="Left" Margin="6,0,0,0" Stretch="Fill" Name="image1" VerticalAlignment="Top" Height="30" Width="57" />
                                        <ItemsControl Margin="70,0,0,0" ItemsSource="{Binding Game.Selection.Building.Resources}">
                                            <ItemsControl.ItemsPanel>
                                                <ItemsPanelTemplate>
                                                    <WrapPanel />
                                                </ItemsPanelTemplate>
                                            </ItemsControl.ItemsPanel>
                                            <ItemsControl.ItemTemplate>
                                                <DataTemplate>
                                                    <ToggleButton Height="30" HorizontalAlignment="Left" Margin="6,4,0,0" VerticalAlignment="Top" Width="30">
                                                        <Image Source="{Binding Thumbnail}" Stretch="UniformToFill" />
                                                    </ToggleButton>
                                                </DataTemplate>
                                            </ItemsControl.ItemTemplate>
                                        </ItemsControl>
                                    </Grid>
                                </StackPanel>
                            </GroupBox>
                        </Grid>
                    </TabItem>
                </this:Wizard>
                
                <Grid Grid.Row="1">
                    <StackPanel Name="PANEL_SelectionDetails">
                        <Grid>
                            <Label Content="Selected Building:" Height="28" HorizontalAlignment="Left" Margin="6,6,0,0" VerticalAlignment="Top" />
                            <Label Content="{Binding Building.Name}" Height="28" HorizontalAlignment="Left" Margin="107,6,0,0" Name="label1" VerticalAlignment="Top" />
                        </Grid>
                        <Grid Margin="5">
                            <CheckBox Content="Stop Production!" VerticalAlignment="Center"/>
                            <Button Content="Destroy" HorizontalAlignment="Right" Margin="120,0,0,0"/>
                        </Grid>
                        <Grid>
                            <Border Height="120" BorderThickness="1" BorderBrush="Gray" CornerRadius="5" Padding="5" VerticalAlignment="Top" HorizontalAlignment="Stretch" Margin="5,0,55,5">
                                <Image Source="{Binding Building.Thumbnail}" HorizontalAlignment="Stretch" Stretch="Uniform" VerticalAlignment="Stretch" />
                            </Border>
                            <StackPanel Orientation="Vertical" Margin="180,0,3,0">
                                <ToggleButton IsChecked="False" Name="BTN_ToggleBuildingConfig" Height="40" HorizontalAlignment="Left" Margin="2" VerticalAlignment="Top" Width="40" Checked="BTN_ToggleBuildingConfig_Checked" Unchecked="BTN_ToggleBuildingConfig_Checked">
                                
                                </ToggleButton>
                                <ToggleButton IsChecked="False" Height="40" HorizontalAlignment="Left" Margin="2" VerticalAlignment="Top" Width="40">

                                </ToggleButton>
                            </StackPanel>
                        </Grid>
                        <Grid>
                            <Label Content="Resources:" />
                            <ItemsControl Margin="0,30,0,0" ItemsSource="{Binding Building.Resources}">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <WrapPanel />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <Border Height="40" HorizontalAlignment="Left" Margin="6,4,0,0" BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Padding="2" VerticalAlignment="Top" Width="60">
                                            <Grid>
                                                <Image Source="{Binding Thumbnail}" Height="30" HorizontalAlignment="Left" Margin="2,2,0,0" Stretch="Uniform" VerticalAlignment="Top" Width="30" />
                                                <Label Content="{Binding Count}" Height="28" HorizontalAlignment="Right" Margin="0,-3,0,0" VerticalAlignment="Top" />
                                                <Label Content="{Binding Difference}" Height="28" HorizontalAlignment="Right" Margin="0,11,0,0" VerticalAlignment="Top" Foreground="Green" />
                                            </Grid>
                                        </Border>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>
                        </Grid>
                    </StackPanel>
                </Grid>
            </Grid>
        </Grid>
    </Grid>
</Window>
